define([],function(){
	function crazykill(){
		Ajax();
	}
	function Ajax(){
		$.ajax({
			type : 'GET',
			url : 'http://h5.yztctech.net/api/axf/apimiaosha.php',
			success : function(data){
				var obj = JSON.parse(data).product,
					html = '';
				for(var i in obj){
					html += '<div class="seckill" id="'+obj[i].id+'" data-enable="'+obj[i].enable+
					'"><div class="seckill_img"><img src="'+obj[i].img+'"/></div><div'+
					' class="seckill_data"><p class="seckill_name">'+obj[i].name+'</p>'+
					'<p class="seckill_num">'+obj[i].specifics+'</p><div class="se'+
					'ckill_price"><span class="seckill_price_now">'+
					'￥<i>'+obj[i].price+'</i></span><span class="seckill_price_before">'+
					'/原价:<i>'+obj[i].market_price+'</i>元</span></div>'+
					'<div class="seckill_buying">'+obj[i].btnText+'</div></div></div>'
				}
				$('#menu').html(html);
				sellOut();
			}
		});
	}
	/*********************抢光时，按钮变色*********************/
	function sellOut(){
		for(var i=0;i<$('.seckill').length;i++){
			if($('.seckill').eq(i).attr('data-enable') == 'false'){
				$('.seckill').eq(i).find('.seckill_buying').addClass('false');
			}
		}
	
	}
	return {
		crazykill : crazykill
	}
})